package ch09_01;

public class Solution {
    public static int stairs(int n) {
	if (n <= 0)
	    return 0;
	if (n <= 2)
	    return n;
	int dp[] = new int[n + 1];
	dp[0] = 1;
	dp[1] = 1;
	dp[2] = 2;
	for (int i = 3; i <= n; i++) {
	    dp[i] = dp[i-3] + dp[i-2] + dp[i-1];
	}
	return dp[n];
    }

    public static void main(String... args) {
	int n = 10;
	for (int i = 0; i <= n; i++) {
	    System.out.println("The kid could jump " + i + " stairs with a total of " + stairs(i) + " steps.");
	}
    }
}